home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / Origami / bindings / fun / go-line < prev    next >
Encoding:
Text File  |  1996-09-27  |  2.9 KB  |  98 lines

  1. ;OCL{{{}}}
  2. ;OCL{{{  comments
  3. ; Same as goto-line, but does only open folds on the way to the line and not
  4. ; close all other folds. The line-argument must be in OCL-variable
  5. ; go-line-arg. The macro isn't to fast on long linear texts.
  6. ;OCL}}}
  7. @if-using not(ocl-file-go-line)
  8.   @use (ocl-file-go-line)
  9.   ;OCL{{{  libs
  10.   @if-using not(ocl-file-error)   @lib error   @fi
  11.   @if-using not(ocl-file-mt-fold) @lib mt-fold @fi
  12.   ;OCL}}}
  13.   ;OCL{{{  vars
  14.   ( defvar
  15.      ( go-line-arg ; input: linenumber
  16.        go-line-x   ; help-counter
  17.      )
  18.   )
  19.   ;OCL}}}
  20.   ;OCL{{{  go-line
  21.   ( deffun go-line
  22.      ( if in-prompt ( return-from-macro ) fi
  23.        local
  24.         ( go-line-x go-line-arg )
  25.         ( screen-off
  26.           while
  27.              pre
  28.               ( set go-line-x -(go-line-arg store-line) )
  29.                 <>(go-line-x 0)
  30.              ;OCL{{{  one step to correct line
  31.              ( if >(go-line-x 0)
  32.                 ;OCL{{{  down
  33.                 ( if test-bottom
  34.                    ( @if-using not(NO-SCR-OFF) screen-on redraw-display @fi
  35.                      return-from-macro
  36.                    )
  37.                   fi
  38.                   next-line
  39.                   @if-using not(NO-SCR-OFF)
  40.                      if >(go-line-x 100)
  41.                       ( if >(go-line-x 200)
  42.                          ( set go-line-x 100 )
  43.                         else
  44.                          ( set go-line-x 20 )
  45.                         fi
  46.                         do
  47.                          ( next-line
  48.                            set go-line-x -(go-line-x 1)
  49.                          )
  50.                         while >(go-line-x 0)
  51.                       )
  52.                      fi
  53.                   @fi
  54.                 )
  55.                 ;OCL}}}
  56.                else
  57.                 ;OCL{{{  up
  58.                 ( if test-top ( return-from-macro ) fi
  59.                   previous-line
  60.                   ;OCL{{{  on fold?, maybe down again
  61.                   if or(test-fold-line,test-filed)
  62.                    ( set go-line-x -(go-line-arg store-line)
  63.                      if =(go-line-x 0)
  64.                       ( @if-using not(NO-SCR-OFF) screen-on redraw-display @fi
  65.                         return-from-macro
  66.                       )
  67.                      fi
  68.                      ;OCL{{{  maybe skip to end of this fold
  69.                      if >(go-line-x 0)
  70.                       ( if test-filed
  71.                          ( @if-using not(NO-SCR-OFF) screen-on redraw-display @fi
  72.                            return-from-macro
  73.                          )
  74.                         fi
  75.                         open-fold
  76.                         mtool-bot
  77.                       )
  78.                      fi
  79.                      ;OCL}}}
  80.                    )
  81.                   fi
  82.                   ;OCL}}}
  83.                 )
  84.                 ;OCL}}}
  85.                fi
  86.              )
  87.              ;OCL}}}
  88.           screen-on
  89.           redraw-display
  90.         )
  91.      )
  92.   )
  93.   ;OCL}}}
  94.   ;OCL{{{  undeclare
  95.   ( undeclare ( go-line-x ) )
  96.   ;OCL}}}
  97. @fi
  98.